import { defineStore } from 'pinia'


export const userStore = defineStore('user', {
  state: () => ({
    token: '',
    name: '',
    avatar: '',
    roles: [],
    permissions: [],
    introduction: '',
    email: '',
    phone: ''
  }),
  actions: {
    setToken(token: string) { //设置token
      this.token = token
    },
    removeToken() { //清空token
      this.token = ''
    }
  },
  getters: {

  },
  persist: true //持久化存储
})

// 关于菜单是否折叠的pinia状态
export const menuStore = defineStore('menu', {
  state: () => ({
    isCollapse: false //是否折叠
  }),
  actions: {
    changeColl(flag: boolean) { //切换菜单是否折叠的方法
      this.isCollapse = flag
    }
  }
})